package com.emr.web.controller.emr;


import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.emr.common.annotation.Log;
import com.emr.common.enums.BusinessType;
import com.emr.common.support.Convert;
import com.emr.module.domain.Blcx;
import com.emr.module.domain.Deahtdis;
import com.emr.module.domain.Jianyanjg;
import com.emr.module.service.IBinglijieyueService;
import com.emr.module.service.IBlcxService;
import com.emr.module.service.IDeahtdisService;
import com.emr.module.service.IJianyanjgService;
import com.emr.module.service.IJieyueService;
import com.emr.system.domain.SysUser;
import com.emr.web.core.base.BaseController;
import com.emr.framework.web.page.TableDataInfo;
import com.emr.common.base.AjaxResult;

/**
 * 病历借阅 信息操作处理
 * 
 * @author emr
 * @date 2019-02-25
 */
@Controller
@RequestMapping("/module/blcx")
public class BlcxController extends BaseController
{
    private String prefix = "module/blcx";
	
	@Autowired
	private IBlcxService blcxService;
	@Autowired
	private IDeahtdisService deahtdisService;
	
	@RequiresPermissions("module:blcx:view")
	@GetMapping()
	public String jianyanjg()
	{
	    return prefix + "/blcx";
	}
	
	/**
	 * 病历借阅列表
	 */
	@RequiresPermissions("module:blcx:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Blcx blcx)
	{
		//获取用户名
		SysUser user = getUser();
		if("".equals(blcx.getPatient_Name())){
			blcx.setPatient_Name(null);
		}
		startPage();
        List<Map<String,Object>> list = blcxService.selectBlcxList(blcx);
		return getDataTable(list);
	}
	@RequiresPermissions("module:blcx:edit")
	@GetMapping("/edit/{id}")
	public String edit(@PathVariable("id") Integer id, ModelMap mmap)
	{
		Blcx blcx = blcxService.selectBlcxListById(id);
		mmap.put("blcx", blcx);
	    return prefix + "/edit";
	}	
	
}
